GCancellable *cancellable,
GError **error);
+gboolean
+_ostree_repo_file_replace_contents (OstreeRepo *self,
+ int dfd,
+ const char *path,
+ guint8 *buf,
+ gsize len,
+ GCancellable *cancellable,
+ GError **error);
+
gboolean
_ostree_repo_write_ref (OstreeRepo *self,
const char *remote,
bufnl[l] = '\n';
bufnl[l+1] = '\0';
- if (!glnx_file_replace_contents_at (dfd, name, (guint8*)bufnl, l + 1,
- self->disable_fsync ? GLNX_FILE_REPLACE_NODATASYNC : GLNX_FILE_REPLACE_DATASYNC_NEW,
- cancellable, error))
+ if (!_ostree_repo_file_replace_contents (self, dfd, name, (guint8*)bufnl, l + 1,
+ cancellable, error))
goto out;
}
}
+/* Replace the contents of a file, honoring the repository's fsync
+ * policy.
+ */
+gboolean
+_ostree_repo_file_replace_contents (OstreeRepo *self,
+ int dfd,
+ const char *path,
+ guint8 *buf,
+ gsize len,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return glnx_file_replace_contents_at (dfd, path, buf, len,
+ self->disable_fsync ? GLNX_FILE_REPLACE_NODATASYNC : GLNX_FILE_REPLACE_DATASYNC_NEW,
+ cancellable, error);
+}
+
/**
* ostree_repo_get_path:
* @self: